﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Activities;

namespace Northeast.BRE.Common
{
    public abstract class RuleBase : CodeActivity<bool>
    {
        public InArgument<ISupportsValidation> Subject { get; set; }
        public InArgument<object[]> Parameters { get; set; }

        protected ISupportsValidation m_Subject;
        protected object[] m_Parameters;

        protected override bool Execute(CodeActivityContext context)
        {
            m_Subject = context.GetValue<ISupportsValidation>(this.Subject);
            m_Parameters = context.GetValue<object[]>(this.Parameters);

            return Validate(context);            
        }

        protected abstract bool Validate(CodeActivityContext context);
    }
}
